#ifndef MYTCPSOCKET_H
#define MYTCPSOCKET_H
#include "MessageType.h"
#include <QTcpSocket>
#include <QObject>
#include <QTimer>
class MyTcpSocket:public QTcpSocket
{
    Q_OBJECT
public:
    MyTcpSocket(QObject *parent = nullptr);

    void sendTLV(TaskType type, int len,const char *msg);
    void readPacket();

    void clear();
signals :
    void readPacketFinished(Packet m_recvPacket);
    void readyReadMyTcpSocket();

private:
    QTimer* m_timeoutTimer;
    int m_expectedBodySize = 0;//当前期望读取的内容长度
    TLV m_recvTLV;//用来保存这个包
    Packet m_packet;//用来接收用这个包

};



#endif // MYTCPSOCKET_H
